package View.ProdutoView;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;

import View.ProdutoView.GrupoPodutoView.GrupoProdutoView;

import Controller.ProdutoController.ProdutoController;
import Entidade.Produto;
import framework.mvc.GenericView;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ProdutoView extends GenericView<Produto> {

	private static final long serialVersionUID = -4258039592749621868L;
	private JPanel panel;
	private JLabel lblCdigoReduzido;
	private JLabel lblGrupo;
	private JLabel lblItem;
	private JLabel lblDescrio;
	private JLabel lblTipoDeProduto;
	private JLabel lblUnidade;
	private JLabel lblSegundaUnidade;
	private JLabel lblTerceiraUnidade;
	private JLabel lblOutrosDados;
	private JLabel lblComplementos;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private JTextField textField_6;
	private JTextField textField_7;
	private JTextField textField_8;
	private JTextField textField_9;
	private JTextField textField_10;
	private JLabel lblFator;
	private JLabel lblFator_1;
	private JTextField textField_11;
	private JPanel panel_1;
	private JButton btnNewButton;
	private JButton btnOutrosDados;
	private JButton btnPreos;
	private JButton btnTributao;
	private JButton btnFornecedores;
	private JButton btnComposio;
	private JButton btnSaldos;
	private JButton btnProdutosPorCliente;
	private JButton btnAlternativos;
	private JButton btnSimilares;
	private JButton button_2;

	public ProdutoView() {
		super(new ProdutoController());
		setResizable(false);
		setTitle("Fox Empresarial - Cadastro de Produtos");
		setSize(new Dimension(615, 453));
		getContentPane().setLayout(new BorderLayout(0, 0));

		panel = new JPanel();
		getContentPane().add(panel, BorderLayout.CENTER);

		lblCdigoReduzido = new JLabel("C\u00F3digo Reduzido:");

		lblGrupo = new JLabel("Grupo:");

		lblItem = new JLabel("Item:");

		lblDescrio = new JLabel("Descri\u00E7\u00E3o:");

		lblTipoDeProduto = new JLabel("Tipo de Produto:");

		lblUnidade = new JLabel("Unidade:");

		lblSegundaUnidade = new JLabel("Segunda Unidade:");

		lblTerceiraUnidade = new JLabel("Terceira Unidade:");

		lblOutrosDados = new JLabel("Outros Dados:");

		lblComplementos = new JLabel("Complementos:");

		textField = new JTextField();
		textField.setEditable(false);
		textField.setName("IdProduto");
		textField.setColumns(10);

		textField_1 = new JTextField();
		textField_1.setColumns(10);

		textField_2 = new JTextField();
		textField_2.setColumns(10);

		textField_3 = new JTextField();
		textField_3.setName("DescricaoProduto");
		textField_3.setColumns(10);

		textField_4 = new JTextField();
		textField_4.setName("TipoProduto");
		textField_4.setColumns(10);

		textField_5 = new JTextField();
		textField_5.setName("SegundaUnidadeProduto");
		textField_5.setColumns(10);

		textField_6 = new JTextField();
		textField_6.setName("UnidadeProduto");
		textField_6.setColumns(10);

		textField_7 = new JTextField();
		textField_7.setName("TerceiraUnidadeProduto");
		textField_7.setColumns(10);

		textField_8 = new JTextField();
		textField_8.setColumns(10);

		textField_9 = new JTextField();
		textField_9.setColumns(10);

		textField_10 = new JTextField();
		textField_10.setName("SegundaUnidadeProduto");
		textField_10.setColumns(10);

		lblFator = new JLabel("Fator:");

		lblFator_1 = new JLabel("Fator:");

		textField_11 = new JTextField();
		textField_11.setName("TerceiraUnidadeProduto");
		textField_11.setColumns(10);

		panel_1 = new JPanel();
		panel_1.setBorder(new TitledBorder(null, "Arquivos Auxiliares:",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));

		JButton button = new JButton("Salvar");
		button.setName("salvar");

		JButton button_1 = new JButton("Cancelar");
		button_1.setName("cancelar");

		button_2 = new JButton("...");
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				GrupoProdutoView grupoProdutoView = new GrupoProdutoView();
				grupoProdutoView.abrir();
			}
		});
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(gl_panel
				.createParallelGroup(Alignment.LEADING)
				.addGroup(
						gl_panel.createSequentialGroup()
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.LEADING)
												.addGroup(
														gl_panel.createSequentialGroup()
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addGroup(
																						gl_panel.createSequentialGroup()
																								.addContainerGap()
																								.addGroup(
																										gl_panel.createParallelGroup(
																												Alignment.LEADING)
																												.addComponent(
																														lblCdigoReduzido)
																												.addComponent(
																														lblGrupo)
																												.addComponent(
																														lblItem)
																												.addComponent(
																														lblDescrio)
																												.addComponent(
																														lblTipoDeProduto)
																												.addComponent(
																														lblUnidade)
																												.addComponent(
																														lblSegundaUnidade)
																												.addComponent(
																														lblTerceiraUnidade)
																												.addComponent(
																														lblOutrosDados)
																												.addComponent(
																														lblComplementos,
																														GroupLayout.PREFERRED_SIZE,
																														70,
																														GroupLayout.PREFERRED_SIZE)))
																				.addGroup(
																						gl_panel.createSequentialGroup()
																								.addGap(143)
																								.addGroup(
																										gl_panel.createParallelGroup(
																												Alignment.LEADING)
																												.addComponent(
																														textField_1,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_2,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_3,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_4,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_6,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_5,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_7,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_8,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_9,
																														GroupLayout.PREFERRED_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.PREFERRED_SIZE))))
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addGroup(
																						gl_panel.createSequentialGroup()
																								.addGap(18)
																								.addGroup(
																										gl_panel.createParallelGroup(
																												Alignment.LEADING,
																												false)
																												.addComponent(
																														lblFator_1,
																														GroupLayout.DEFAULT_SIZE,
																														GroupLayout.DEFAULT_SIZE,
																														Short.MAX_VALUE)
																												.addComponent(
																														lblFator,
																														GroupLayout.DEFAULT_SIZE,
																														45,
																														Short.MAX_VALUE))
																								.addPreferredGap(
																										ComponentPlacement.UNRELATED)
																								.addGroup(
																										gl_panel.createParallelGroup(
																												Alignment.TRAILING)
																												.addComponent(
																														textField_10,
																														Alignment.LEADING,
																														GroupLayout.PREFERRED_SIZE,
																														108,
																														GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														textField_11,
																														Alignment.LEADING,
																														GroupLayout.PREFERRED_SIZE,
																														108,
																														GroupLayout.PREFERRED_SIZE)))
																				.addGroup(
																						gl_panel.createSequentialGroup()
																								.addPreferredGap(
																										ComponentPlacement.RELATED)
																								.addComponent(
																										button_2))))
												.addGroup(
														gl_panel.createSequentialGroup()
																.addContainerGap()
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.TRAILING)
																				.addGroup(
																						gl_panel.createSequentialGroup()
																								.addComponent(
																										button,
																										GroupLayout.PREFERRED_SIZE,
																										63,
																										GroupLayout.PREFERRED_SIZE)
																								.addGap(18)
																								.addComponent(
																										button_1,
																										GroupLayout.PREFERRED_SIZE,
																										75,
																										GroupLayout.PREFERRED_SIZE))
																				.addComponent(
																						panel_1,
																						GroupLayout.PREFERRED_SIZE,
																						569,
																						GroupLayout.PREFERRED_SIZE))))
								.addContainerGap(30, Short.MAX_VALUE)));
		gl_panel.setVerticalGroup(gl_panel
				.createParallelGroup(Alignment.LEADING)
				.addGroup(
						gl_panel.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.TRAILING)
												.addGroup(
														gl_panel.createSequentialGroup()
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						textField,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						lblCdigoReduzido,
																						Alignment.TRAILING))
																.addPreferredGap(
																		ComponentPlacement.RELATED)
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						lblGrupo,
																						Alignment.TRAILING)
																				.addComponent(
																						textField_1,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						button_2,
																						Alignment.TRAILING))
																.addPreferredGap(
																		ComponentPlacement.RELATED)
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						textField_2,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						lblItem,
																						Alignment.TRAILING))
																.addPreferredGap(
																		ComponentPlacement.RELATED)
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						textField_3,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						lblDescrio,
																						Alignment.TRAILING))
																.addPreferredGap(
																		ComponentPlacement.RELATED)
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						lblTipoDeProduto,
																						Alignment.TRAILING)
																				.addComponent(
																						textField_4,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE))
																.addPreferredGap(
																		ComponentPlacement.RELATED)
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						textField_6,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						lblUnidade,
																						Alignment.TRAILING))
																.addPreferredGap(
																		ComponentPlacement.RELATED)
																.addGroup(
																		gl_panel.createParallelGroup(
																				Alignment.LEADING)
																				.addComponent(
																						lblSegundaUnidade,
																						Alignment.TRAILING)
																				.addComponent(
																						textField_5,
																						Alignment.TRAILING,
																						GroupLayout.PREFERRED_SIZE,
																						GroupLayout.DEFAULT_SIZE,
																						GroupLayout.PREFERRED_SIZE)))
												.addComponent(lblFator)
												.addComponent(
														textField_10,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE))
								.addPreferredGap(ComponentPlacement.RELATED)
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.TRAILING)
												.addComponent(
														lblTerceiraUnidade)
												.addComponent(
														textField_7,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE)
												.addComponent(lblFator_1)
												.addComponent(
														textField_11,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE))
								.addPreferredGap(ComponentPlacement.RELATED)
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.LEADING)
												.addComponent(
														textField_8,
														Alignment.TRAILING,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE)
												.addComponent(lblOutrosDados,
														Alignment.TRAILING))
								.addPreferredGap(ComponentPlacement.RELATED)
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.LEADING)
												.addComponent(lblComplementos,
														Alignment.TRAILING)
												.addComponent(
														textField_9,
														Alignment.TRAILING,
														GroupLayout.PREFERRED_SIZE,
														GroupLayout.DEFAULT_SIZE,
														GroupLayout.PREFERRED_SIZE))
								.addGap(18)
								.addComponent(panel_1,
										GroupLayout.PREFERRED_SIZE,
										GroupLayout.DEFAULT_SIZE,
										GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(ComponentPlacement.RELATED)
								.addGroup(
										gl_panel.createParallelGroup(
												Alignment.LEADING)
												.addComponent(button)
												.addComponent(button_1))
								.addContainerGap(13, Short.MAX_VALUE)));
		gl_panel.linkSize(SwingConstants.HORIZONTAL, new Component[] {
				lblCdigoReduzido, lblGrupo, lblItem, lblDescrio,
				lblTipoDeProduto, lblUnidade, lblSegundaUnidade,
				lblTerceiraUnidade, lblOutrosDados, lblComplementos });
		gl_panel.linkSize(SwingConstants.HORIZONTAL, new Component[] { button,
				button_1 });

		btnNewButton = new JButton("Saldos Iniciais");

		btnOutrosDados = new JButton("Outros Dados");

		btnPreos = new JButton("Pre\u00E7os");

		btnTributao = new JButton("Tributa\u00E7\u00E3o");

		btnFornecedores = new JButton("Fornecedores");

		btnComposio = new JButton("Composi\u00E7\u00E3o");

		btnSaldos = new JButton("Saldos");

		btnProdutosPorCliente = new JButton("Por Cliente");

		btnAlternativos = new JButton("Alternativos");

		btnSimilares = new JButton("Similares");
		GroupLayout gl_panel_1 = new GroupLayout(panel_1);
		gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_panel_1
						.createSequentialGroup()
						.addContainerGap()
						.addGroup(
								gl_panel_1
										.createParallelGroup(Alignment.LEADING)
										.addComponent(btnNewButton)
										.addComponent(btnOutrosDados))
						.addPreferredGap(ComponentPlacement.RELATED)
						.addGroup(
								gl_panel_1
										.createParallelGroup(Alignment.LEADING)
										.addComponent(btnPreos)
										.addComponent(btnTributao))
						.addPreferredGap(ComponentPlacement.RELATED)
						.addGroup(
								gl_panel_1
										.createParallelGroup(Alignment.LEADING)
										.addComponent(btnFornecedores)
										.addComponent(btnComposio))
						.addPreferredGap(ComponentPlacement.RELATED)
						.addGroup(
								gl_panel_1
										.createParallelGroup(Alignment.LEADING)
										.addComponent(btnAlternativos)
										.addComponent(btnSimilares))
						.addPreferredGap(ComponentPlacement.RELATED)
						.addGroup(
								gl_panel_1
										.createParallelGroup(Alignment.LEADING)
										.addComponent(btnProdutosPorCliente)
										.addComponent(btnSaldos,
												GroupLayout.PREFERRED_SIZE, 74,
												GroupLayout.PREFERRED_SIZE))));
		gl_panel_1
				.setVerticalGroup(gl_panel_1
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_panel_1
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_panel_1
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_panel_1
																		.createSequentialGroup()
																		.addComponent(
																				btnSaldos)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				btnProdutosPorCliente))
														.addGroup(
																gl_panel_1
																		.createSequentialGroup()
																		.addComponent(
																				btnAlternativos)
																		.addGap(6)
																		.addComponent(
																				btnSimilares))
														.addGroup(
																gl_panel_1
																		.createSequentialGroup()
																		.addComponent(
																				btnFornecedores)
																		.addGap(6)
																		.addComponent(
																				btnComposio))
														.addGroup(
																gl_panel_1
																		.createParallelGroup(
																				Alignment.TRAILING)
																		.addGroup(
																				gl_panel_1
																						.createSequentialGroup()
																						.addComponent(
																								btnPreos)
																						.addGap(6)
																						.addComponent(
																								btnTributao))
																		.addGroup(
																				gl_panel_1
																						.createSequentialGroup()
																						.addComponent(
																								btnNewButton)
																						.addGap(6)
																						.addComponent(
																								btnOutrosDados))))
										.addContainerGap()));
		gl_panel_1.linkSize(SwingConstants.HORIZONTAL, new Component[] {
				btnNewButton, btnOutrosDados, btnPreos, btnTributao,
				btnFornecedores, btnComposio, btnSaldos, btnProdutosPorCliente,
				btnAlternativos, btnSimilares });
		panel_1.setLayout(gl_panel_1);
		panel.setLayout(gl_panel);
	}
}
